package com.wf.course.web.controller.sys;

import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.utils.page.PageBean;
import com.wf.course.model.log.SysOperateLog;
import com.wf.course.service.ISysOperateLogService;
import com.wf.course.web.Interceptor.LogInfo;


/**
 * 系统操作日志控制器
 *
 */
@Controller
@RequestMapping("sysOperateLog")
public class SysOperateLogController {

	@Autowired
	private ISysOperateLogService iSysOperateLogService;

	@LogInfo("查看系统操作日志信息列表")
	@RequestMapping("sysOperateLogList")
	public String list(
			@RequestParam(value = "pageNo", required = false) Integer pageNo,
			@RequestParam(value = "pageSize", required = false) Integer pageSize,
			@RequestParam(value = "userName", required = false) String userName, 
			@RequestParam(value = "intro", required = false) String intro, 
			@RequestParam(value = "createTimeBegin", required = false) String createTimeBegin, 
			@RequestParam(value = "createTimeEnd", required = false) String createTimeEnd,
			Model model
			){
		
			// 组装一个查询条件的map
				Map<String, Object> cons = new HashMap<String, Object>();
				if(userName!=null && userName!=""){
					cons.put("userName", userName);
				}
				if(intro!=null && intro!=""){
					cons.put("intro", intro);
				}
				if(createTimeBegin!=null && createTimeBegin!=""){
					cons.put("createTimeBegin", createTimeBegin);
				}
				if(createTimeEnd!=null && createTimeEnd!=""){
					cons.put("createTimeEnd", createTimeEnd);
				}
				
				PageBean<SysOperateLog> pageBean = new PageBean<SysOperateLog>(pageNo, pageSize, null, cons);
				pageBean.setUrl("sysOperateLog/sysOperateLogList");
				this.iSysOperateLogService.indexInfo(pageBean);
				
				model.addAttribute("page", pageBean);
		
		return "sys/sysOperateLogList";
	}
}
